clear all; clc; close all;
R=120;
C=33e-12;
tau=R*C;
T=tau/300;
t=0:T:(100*tau);
N=length(t);
omega=1e09;

omega = 2*pi * ((1/tau/100):(1/tau / 100):(1/tau/2));
M = length(omega);

    U = zeros(1, N);
    E = zeros(1, N);
for l = 1:M

    for k=2:N;
        if t(k)<0
            E(k)=0;
        else
            E(k)=sin(k*T*omega(l));
        end;
        U(k)=U(k-1)-(T/tau)*U(k-1)+E(k)*T/(2*tau);
    end;
    K(l) = (max(U) - min(U))/2;
end
figure(1);
plot(t,E,t,U)

figure(2);
plot(omega/2/pi, K)
xlabel('f, Hz')
ylabel('|K(j\omega)|')
grid on